#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QIcon icon(":/icon/chat.ico");
    this->setWindowIcon(icon);

    // 设置初始中央部件
    SlotsSwitchLog();
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::SlotsSwitchReg()
{
     _register_dialog = new RegisterDialog();
    setCentralWidget(_register_dialog);
    //点击注册页面的取消按钮，跳转到登录界面
    connect(_register_dialog,&RegisterDialog::switchLogin,this,&MainWindow::SlotsSwitchLog);
}

void MainWindow::SlotsSwitchLog()
{
    _login_dialog = new LoginDialog();
    setCentralWidget(_login_dialog);
    //点击注册按钮，跳转到注册页面的连接
    connect(_login_dialog,&LoginDialog::switchRegister,this,&MainWindow::SlotsSwitchReg);
}


